<%--
  Created by IntelliJ IDEA.
  User: 范军建
  Date: 2022/4/15
  Time: 21:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">

    function submit() {
        var pno = $("#pno").val();
        var name = $("#name").val();
        var sex = $('input[name="sex"]:checked').val();
        var age = $("#age").val();
        var height = $("#height").val();
        var weight = $("#weight").val();

        var data={

            "pno":pno,
            "name":name,
            "sex":sex,
            "age":age,
            "height":height,
            "weight" : weight
        }


        $.ajax({
            type : "post",
            url : "Hello",
            data : data,
            cache : true,
            async : true,
            success: function (data ,textStatus, jqXHR){
                if(data.code == 200){
                    alert("插入成功了");
                }else{
                    alert(data.message);
                }
            },
            error:function (XMLHttpRequest, textStatus, errorThrown) {

                alert(typeof(errorThrown));
            }

        });
    }


<input type="button" value="插入" id="btn_1" onclick="submit()"/>
<input type="button" value="查询" id="btn_2" onclick="query()"/>
<input type="button" value="删除" id="btn_3" onclick="del()"/>
<input type="button" value="更新" id="btn_4" onclick="update()"/>
</body>
</html>
